package javaRew;

/**
 * Created by xjweng on 2017/1/30.
 */
public class TestCylinder {
    public static void main(String[] args){
        Cylinder cyl_1 = new Cylinder(1,3);
        cyl_1.setLength(2);
        System.out.println(cyl_1.findVolume());
        System.out.println(cyl_1.findArea());
    }
}
class Cylinder extends Circle{
    private double length;
    public Cylinder(double radius,double length){
        //调用父类构造方法
        super(radius);
        this.length = length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    public double getLength() {
        return length;
    }

    //表面积
    @Override
    public double findArea() {
        return super.findArea()*2 + 2 * Math.PI * super.getRadius()*this.length;
    }

    //体积
    public double findVolume(){
        return super.findArea()*this.length;
    }
}